package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String [] array={"one","two","three","four","five"};
//        for (int i = 0; i < array.length; i++) {
//            System.out.print(array[i]+" ");
//        }
        for(String s:array){
            System.out.print(s+" ");
        }


        System.out.println();

        Collection c=new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
//        Iterator ite=c.iterator();
//        while(ite.hasNext()){
//            String s=ite.next().toString();
//            System.out.print(s+" ");
//        }
        for(Object o:c){
            String s=(String)o;
            System.out.print(s+" ");
        }
    }
}
